# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=dfu-util
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=0.10
pkgrel=4
pkgdesc='Device firmware upgrade utilities (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
license=('GPL2')
groups=("${MINGW_PACKAGE_PREFIX}-eda")
url='http://dfu-util.sourceforge.net/'
depends=("${MINGW_PACKAGE_PREFIX}-libusb"
         "${MINGW_PACKAGE_PREFIX}-libwinpthread-git")
source=(
    "https://downloads.sourceforge.net/project/dfu-util/dfu-util-${pkgver}.tar.gz"
    01-fix-off-t-size.patch
)
sha256sums=(
    'a03dc58dfc79c056819c0544b2a5970537566460102b3d82cfb038c60e619b42'
    '475d70ea76e822b612f40180a8f2dad58ce21834e73d961e9594c7f9922af5f8'
)

prepare() {
    cd ${srcdir}/${_realname}-${pkgver}

    patch -p1 -i ../01-fix-off-t-size.patch
}

build() {
    cd ${srcdir}/${_realname}-${pkgver}
    ./configure --prefix=${MINGW_PREFIX}
}

package() {
    cd ${srcdir}/${_realname}-${pkgver}
    make DESTDIR="$pkgdir" install
}
